//----------------------------------------------------------------------------
// M A R I T I M E  R E S E A R C H  I N S T I T U T E  N E T H E R L A N D S
//----------------------------------------------------------------------------
// Copyright (C) 2012 - MARIN - All rights reserved - http://www.marin.nl
//----------------------------------------------------------------------------
// Program    : mermaid
// Module     : vbm
// File       : wvin_comp.h
// Author     : M.A. de Jong
//----------------------------------------------------------------------------

#ifndef WVIN_COMP_H
#define WVIN_COMP_H

#include "kernels/wvin_comp_kernels.h"

namespace incomingwaves
{

template <class T>
inline void wvin_comp(T* zeta_in_X_loc,
                      T*  phi_in_X_loc,
                      T*  psi_in_X_loc,
                      const int* wvin_X_count,
                      const T* wvin_X_loc_ampl,
                      const T* wvin_X_loc_phase,
                      const T* wvin_X_loc_freq,
                      const T* wvin_X_loc_facphi,
                      const T* wvin_X_loc_facpsi,
                      const int N,
                      const T timestep,
                      const T pslow,
                      const int number,
                      cudaStream_t stream)
{
    // tiling
    int numBlocks = N / NUM_THREADS;

    // launch kernel
    incomingwaves::kernel_wvin_comp<T> <<< numBlocks, NUM_THREADS, 0, stream >>>
        (zeta_in_X_loc, phi_in_X_loc, psi_in_X_loc,
         wvin_X_count,
         wvin_X_loc_ampl, wvin_X_loc_phase, wvin_X_loc_freq,
         wvin_X_loc_facphi, wvin_X_loc_facpsi,
         N, timestep, pslow, number);

    checkCudaError(cudaGetLastError(), "incomingwaves::kernel_wvin_comp");
}

} // namespace incomingwaves

#endif // WVIN_COMP_H

